<template>
	<view class="contant">
		<view style="position: absolute; top: 47px; left: 15px">
			<u-icon @click="back" name="arrow-left" color="#fff" size="24"></u-icon>
		</view>
		<view class="long" style="">扫一扫关注公众号</view>
		<view class="ma" style="">
			<image style="width: 160px; height: 160px" :src="imgurl + com_info.wxqrcode" mode=""></image>
		</view>
		<view class="notice">
			<view style="font-size: 14px; color: #0225A3; font-weight: 400">订阅公众号通知</view>
			<view>
				<u-switch @change="change" space="2" v-model="value11" activeColor="#fff"
					inactiveColor="rgb(230, 230, 230)"></u-switch>
			</view>
		</view>
		<!-- <view class="about">
			<view style="text-align: center; color: #be4d08; font-size: 18px">关注公众号</view>
			<view style="text-align: center; color: #be4d08; font-size: 18px">第一时间了解以下重要通知</view>
			<view class="flex" style="justify-content: space-between; margin: 15px 23px 20px">
				<view>
					<image style="width: 60px" src="/static/img/25.png" mode="widthFix"></image>
					<view style="font-size: 14px; color: #1d1f20; font-weight: 400">项目结算</view>
				</view>
				<view>
					<image style="width: 60px" src="/static/img/26.png" mode="widthFix"></image>
					<view style="font-size: 14px; color: #1d1f20; font-weight: 400">报名审核</view>
				</view>
				<view>
					<image style="width: 60px" src="/static/img/27.png" mode="widthFix"></image>
					<view style="font-size: 14px; color: #1d1f20; font-weight: 400">重要公告</view>
				</view>
			</view>
			<view class="flex" style="justify-content: space-between; margin: 0px 23px">
				<view style="text-align: center">
					<image style="width: 60px" src="/static/img/28.png" mode="widthFix"></image>
					<view style="font-size: 14px; color: #1d1f20; font-weight: 400">提现到账</view>
				</view>
				<view style="text-align: center">
					<image style="width: 60px" src="/static/img/29.png" mode="widthFix"></image>
					<view style="font-size: 14px; color: #1d1f20; font-weight: 400">客服回复</view>
				</view>
				<view style="text-align: center">
					<image style="width: 60px" src="/static/img/30.png" mode="widthFix"></image>
					<view style="font-size: 14px; color: #1d1f20; font-weight: 400">项目上架</view>
				</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	import config from '../../common/config/index.js';
	export default {
		data() {
			return {
				value11: false,
				imgurl: config.imgurl,
				com_info: '',
				prourl: config.prodBase,
				fl: '',
			};
		},
		onLoad(e) {
			this.fl = e.fl;
			this.fllow();
			this.common();
		},
		onBackPress() {
			let that = this;
			console.log('press back');
			console.log(this.fl);
			if (that.fl == 'reg') {
				uni.switchTab({
					url: '/pages/index/me',
				});
			} else {
				uni.navigateBack({
					delta: 1,
				});
			}
		},
		methods: {
			async change(e) {
				let res = await this.$http.index.followWeChat({
					open: e ? 1 : 0,
				});
				if (res.code == 1) {
					this.$tips(res.msg);
				} else {
					this.value11 = false;
					this.$tips(res.msg);
				}
			},
			async common() {
				let res = await this.$http.index.index();
				if (res.code == 1) {
					this.com_info = res.data;
					// this.value11 = res.data.is_openid == 0 ? false : true
				}
			},
			async fllow() {
				let that = this;
				uni.request({
					url: that.prourl + 'user/followWeChat',
					method: 'GET',
					header: {
						token: uni.getStorageSync('token'),
					},
					success(res) {
						that.value11 = res.data.data.is_openid == 0 ? false : true;
					},
				});
			},

			back() {
				if (this.fl == 'reg') {
					uni.switchTab({
						url: '/pages/index/me',
					});
				} else {
					uni.switchTab({
						url: '/pages/index/me',
					});
					// uni.navigateBack({
					// 	delta: 1,
					// });
				}
			},
		},
	};
</script>

<style scoped lang="scss">
	/deep/ .u-switch__node {
		background-color: #CACACA;
	}

	.contant {
		background-image: url('@/static/img/24.png');
		background-repeat: no-repeat;
		background-size: 100% 100%;
		min-height: 729px;
		position: relative;

		.long {
			font-size: 22px;
			font-weight: 400;
			color: #06269D;
			line-height: 38px;
			position: absolute;
			left: 50%;
			// width: 100%;
			transform: translateX(-50%);
			top: 15%;
		}

		.ma {
			position: absolute;
			top: 0;
			left: 50%;
			transform: translateX(-50%);
			top: 30%;
		}

		.notice {
			display: flex;
			align-items: center;
			justify-content: space-between;
			position: absolute;
			top: 0;
			left: 15%;
			width: 70%;
			top: 82%;
		}

		.about {
			position: absolute;
			top: 60%;
			width: 84%;
			background-color: #fdd9c3;
			// height: 80px;
			left: 8%;
			border-radius: 10px;
			padding: 15px 0;
		}
	}
</style>